package com.example.aerospacemanagementsystem.controller.logistics;

import com.example.aerospacemanagementsystem.entity.logistics.Safety;
import com.example.aerospacemanagementsystem.entity.logistics.Usage;
import com.example.aerospacemanagementsystem.service.logisticsService.impl.SafetyService;
import com.example.aerospacemanagementsystem.service.logisticsService.impl.UsageService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * @author 李铭
 */
@Api(tags = "用车记录")
@RestController
@CrossOrigin
@RequestMapping("/usage")

public class UsageController {
    @Autowired
    private UsageService usageService;

    @PostMapping
    public int add(@RequestBody Usage usage){
        return usageService.add(usage);
    }

    @DeleteMapping
    public int delete(Usage usage){
        return usageService.delete(usage);
    }

    @PutMapping
    public int update(@RequestBody Usage usage){
        return usageService.update(usage);
    }

    @GetMapping("/getAll")
    public List<Usage> getAllCity(Usage usage) {
        List<Usage> list = usageService.getAllUsage(usage);
        return list;
    }
}
